﻿// JScript 文件
 function addheight(action){
        var change=30;
        var obj=document.getElementById("ctl00_ContentPlaceHolder1_FormView1_RegProtocalContent");       
        var newheight;
        if(action=="add"){
          newheight = parseInt(obj.style.height, 10) + change;
        }
        else if(action=="sub") {	//大于最小高度100时才执行
          newheight = parseInt(obj.style.height, 10);
          if(newheight>70){
           newheight=newheight-change;
          }		  
		}
        obj.style.height = newheight + 'px';
      } 
          
      function ShowHide(ctlname,controlname){
        var hidecontrol=document.getElementById(controlname);
        if(document.getElementById(ctlname+"_1").checked){
           hidecontrol.style.display="";
         }
         else{
           hidecontrol.style.display="none";
         } 
      
      }
      function SelectWaterType(ctlName){
        var textTable=document.getElementById("Text_Watermark");
        var picTable=document.getElementById("Pic_Watermark");
        if(document.getElementById(ctlName+"_0").checked){
           textTable.style.display=picTable.style.display="none";
        }
        else if(document.getElementById(ctlName+"_1").checked){
           textTable.style.display="";
           picTable.style.display="none";
        }
        else{
            textTable.style.display="none"
            picTable.style.display="";
        }
      
      }
      
      function ShowSiteRegKey(ctlName){
         var _SiteRegKeyObj=document.getElementById("SiteRegKey");
         var _CheckSiteRegKey=document.getElementById("CheckSiteRegKey");
         if(document.getElementById(ctlName+"_0").checked){
            _SiteRegKeyObj.style.display="";
            _CheckSiteRegKey.style.display="";
         }
         else
         { 
            _SiteRegKeyObj.style.display="none";
            _CheckSiteRegKey.style.display="none";
         }
      }
     
function CreateSecurityCode(CodeType)
{
	var s = (new Date()).toGMTString();
	s += location.href;
	s += navigator.appVersion;
	if(CodeType=="font")
	{
	   document.getElementById("ctl00_ContentPlaceHolder1_FormView1_SecurityKey").value = randomChar(16);
	}
	else if(CodeType="admin")
	{
	   document.getElementById("ctl00_ContentPlaceHolder1_FormView1_AdminSecurityKey").value = randomChar(16);
	}   
}
function copyCcode(CodeType)
{
	var obj;
	if(CodeType=="font")
	{
	   obj=document.getElementById("ctl00_ContentPlaceHolder1_FormView1_SecurityKey");
	}
	else if(CodeType="admin")
	{
	   obj=document.getElementById("ctl00_ContentPlaceHolder1_FormView1_AdminSecurityKey");
	}   
	obj.focus();
	obj.select();
	document.execCommand("copy");
	
}
function clearCcode(CodeType)
{
	var obj;
	if(CodeType=="font")
	{
	   obj=document.getElementById("ctl00_ContentPlaceHolder1_FormView1_SecurityKey");
	}
	else if(CodeType="admin")
	{
	   obj=document.getElementById("ctl00_ContentPlaceHolder1_FormView1_AdminSecurityKey");
	}   
	obj.value="";
}
function randomChar(len) {
 var x="0123456789poiuytrewqasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVBNM";
 var tmp="";
 for(var i=0;i< len;i++) {
 tmp += x.charAt(Math.ceil(Math.random()*100000000)%x.length);
 }
 return tmp; 
}

function ShowAliPaySet(objValue){ 
  var _setObj=document.getElementById("ctl00_ContentPlaceHolder1_FormView1_AliPay_Config");
  if(_setObj!=null)
  {
     if(objValue==""||objValue==null)
     {
       objValue=_setObj.value;
     }
  }
  var _selfaccount=document.getElementById("self_account");
  var _selfkey=document.getElementById("self_key");
   _selfaccount.style.display=_selfkey.style.display="none";
  if(objValue=="self")
  {
    _selfaccount.style.display=_selfkey.style.display="";
  } 

}




